<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
    <style>
        .activated {
            color: red
        }

        .fontSize {
            font-size: 100px;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- 数组里面可以放多个样式类 -->
        <div @click="handleDivClick" :class="[activated,fontSize]">helloworld</div>
    </div>

    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                activated: '',
                fontSize: ''
            },
            methods: {
                // 点击后，相当于从class=""======>class="activated"
                handleDivClick: function () {
                    // 实现连点切换
                    if (this.activated === "activated") {
                        this.activated = ""
                    } else {
                        this.activated = "activated"
                        this.fontSize = "fontSize"
                    }

                }
            }
        })
    </script>
</body>

</html>